﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

namespace StuClassInfo.StuCommon
{
    public class JSHelper
    {
        #region 弹出对话框提示信息
        /// <summary>
        /// 弹出对话框提示信息
        /// </summary>
        /// <param name="page"></param>
        /// <param name="alert"></param>
        public static void Alert(Page page, string alert)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "alert", $"<script>alert('{alert}')</script>");
        }
        #endregion

        #region 弹出对话框提示信息，并跳转页面
        /// <summary>
        /// 弹出对话框提示信息，并跳转页面
        /// </summary>
        /// <param name="page"></param>
        /// <param name="alert"></param>
        /// <param name="url"></param>
        public static void Alert(Page page, string alert, string url)
        {
            page.ClientScript.RegisterStartupScript(page.GetType(), "alert", $"<script>alert('{alert}');location.href='{url}'</script>");
        }
        #endregion
    }
}